package pers.xiqingbo.dao.impl;

import pers.xiqingbo.dao.BaseDao;
import pers.xiqingbo.dao.OrderItemDao;
import pers.xiqingbo.pojo.OrderItem;

/**
 * @PackageName: pers.xiqingbo.dao.impl
 * @ClassName: OrderItemDaoImpl
 * @Description: 订单项数据访问层实现类
 * @Author: Schieber
 * @Date: 2021/3/3 上午 5:56
 */
public class OrderItemDaoImpl extends BaseDao implements OrderItemDao {
    /**
     * 保存订单项信息
     *
     * @param orderItem 订单项信息
     * @return 返回保存订单项后影响的行数
     */
    @Override
    public int saveOrderItem(OrderItem orderItem) {
        String sql = "insert into t_order_item(`name`,`count`,`price`,`total_price`,`order_id`) values(?,?,?,?,?)";
        return update(sql, orderItem.getName(), orderItem.getCount(), orderItem.getPrice(), orderItem.getTotalPrice(), orderItem.getOrderId());
    }
}
